﻿using KJSyncXP.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace KJSyncXP.Views.pop
{
    /// <summary>
    /// LoginWindow.xaml 的交互逻辑
    /// </summary>
    public partial class LoginWindow : Window
    {

        private LoginViewModel _viewModel;

        public LoginWindow(LoginViewModel viewModel)
        {
            InitializeComponent();
            // 绑定上下文（用于账号输入框的双向绑定）
            _viewModel = viewModel;
            this.DataContext = viewModel;
        }


        // PasswordBox输入变化时，同步到ViewModel的Password属性
        private void PbPassword_PasswordChanged(object sender, RoutedEventArgs e)
        {
            var passwordBox = sender as PasswordBox;

            if (passwordBox != null && _viewModel != null)
            {
                _viewModel.Password = passwordBox.Password;
            }
        }

    }
}
